<?php
/**
 * Created by 陈俊伟.
 * User: Administrator
 * Date: 2019-10-28
 * Time: 下午 2:52
 */

namespace App\Lib\PHPExcel\ManuOrder;

use App\Lib\PHPExcel\ExcelHandle;

class Full extends ExcelHandle
{
    /*
     * 工厂模式
     * 普通厂家订单格式定制
     * */
    public function arrange($origin_arr)
    {

        $arr = [
            0 => [
                '店铺名称', '厂家', '订单编号', '商品名', '单号',
                '订单状态', '详细', '颜色', '尺码', '直播', '跟播', '商品链接',
                '收件人', '收件人手机号', '省', '市', '区', '收件地址',
                '用户留言', '商户备注','退款理由','下单数量', '订单提交时间',
                 '售价', '成本价','实际成本价','快递费','打包费','是否退回厂家','退款是否收回',
                '物流单号','物流发起地','线下货款','线下快递费','线下备注','线下承担者'
            ]
        ];
        $i = 1;
        foreach ($origin_arr as $data) {
            $arr[$i]['店铺名称'] = $data['shop_name']; //店铺名称
            $arr[$i]['厂家'] = $data['manu_name'];  //厂家信息
            $arr[$i]['订单编号'] = $data['order_id']; //订单id
            $arr[$i]['商品名'] = $data['origin_prod_name']; //商品名
            $arr[$i]['单号'] = $data['prod_no']; //单号
            $arr[$i]['订单状态'] = $data['order_status_text']; //订单状态
            $arr[$i]['详细'] = $data['prod_detail'];
            $arr[$i]['颜色'] = $data['color'];
            $arr[$i]['尺码'] = $data['size'];
            $tmp_liver = $data['liver'];
            if($tmp_liver == "范丽斌"){
                $tmp_liver = "大姑妈";
            }
            if($tmp_liver == "沈立妙"){
                $tmp_liver = "沈小小";
            }
            $arr[$i]['直播'] = $tmp_liver;
            $arr[$i]['跟播'] = $data['wither'];
            $arr[$i]['商品链接'] = '';
            $arr[$i]['收件人'] = $data['post_receiver'] ?? ''; //收件人
            $arr[$i]['收件人手机号'] = $data['post_tel'] ?? ''; //收件人电话
            $arr[$i]['省'] = $data['province'] ?? '';
            $arr[$i]['市'] = $data['city'] ?? '';
            $arr[$i]['区'] = $data['town'] ?? '';
            $arr[$i]['收件地址'] = $data['full_addr'] ?? ''; //收件地址
            $arr[$i]['用户留言'] = $data['buyer_words'] ?? ''; //用户留言
            $arr[$i]['商户备注'] = $data['seller_words'] ?? ''; //商户备注
            $arr[$i]['退款理由'] = $data['refund_reason'] ?? ''; //退款理由
            $arr[$i]['下单数量'] = $data['combo_num'] ?? ''; //下单数量
            $arr[$i]['订单提交时间'] = $data['create_time'] ?? ''; //下单日期
            $arr[$i]['售价'] = $data['total_amount'];
            $arr[$i]['成本价'] = $data['tmp_cost_price'] ?? '';
            $arr[$i]['实际成本价'] = $data['cost_price'] ?? '';
            $arr[$i]['快递费'] = $data['express_fee'];
            $arr[$i]['打包费'] = $data['packing_charge'] ?? '';
            $arr[$i]['是否退回厂家'] = $data['return_to_manu'] ?? '';
            $arr[$i]['退款是否收回'] = $data['refund_is_recovered'] ?? '';
            $arr[$i]['物流单号'] = $data['logistics_code'] ?? '';
            $arr[$i]['物流发起地'] = $data['logistics_from'] ?? '';

            $arr[$i]['线下货款'] = $data['unline_payment'] ?? '';
            $arr[$i]['线下快递费'] = $data['unline_express_fee'] ?? '';
            $arr[$i]['线下备注'] = $data['unline_mark'] ?? '';
            $arr[$i]['线下承担者'] = $data['unline_trager'] ?? '';
            $i++;
        }

        return $arr;
    }


}